package com.spboot.controller.advice;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * 异常处理
 * @author 随风
 *
 */
@ControllerAdvice
public class ExceptionResolver {
	
	/**
	 * 没有权限异常
	 * @param e
	 * @return
	 */
	@ResponseStatus(code = HttpStatus.UNAUTHORIZED)
	@ExceptionHandler(AuthorizationException.class)
	public String ex(AuthorizationException e){
		return "unauth";
	}
}
